
import React from 'react';
import css from './index.less';
import Icon from 'components/icon';
import PropTypes from 'prop-types';

class InnerGroup extends React.Component {
  constructor(props) {
    super(props);
    this.state = {

    };

  }

  static propTypes = {
    ind: PropTypes.number,
    readOnly: PropTypes.bool,
    showImg: PropTypes.func,
  };

  showImg(id) {
    const { readOnly } = this.props;
    if (readOnly) {
      const { showImg = () => {}} = this.props;
      showImg(id);
    }

  }

  render() {
    const {id, showImg, ...other} = this.props;
    // showImg 不要删掉，不然会警告类型错误
    const props = {
      ...other,
      className: css.panel,
      onClick: this.showImg.bind(this, id),

    };

    return (
      <div {...props} >
        <div className={css.title}><Icon type="icon-group" className={css.icon}/>
          <p>{props.title} </p>
        </div>
      </div>
    );
  }
}

export default InnerGroup;
















